package org.ravenhearte.hardboild.gamelogic;

import java.util.HashMap;

public abstract class SkillSet {
	private String name;
	private HashMap<String, Skill> skills;
	private HashMap<String, Skill> knownSkills;
	private int rating;
	public final Type type;
	private GameCharacter parent;
	public enum Type { ACTIVE, PASSIVE };
	
	public SkillSet(String name, Type type, GameCharacter parent) {
		this.name = name;
		this.type = type;
		this.parent = parent;
		skills = new HashMap<String, Skill>();
		knownSkills = new HashMap<String, Skill>();
		rating = 0;
	}
	
	protected void addSkill(Skill skill) {
		skills.put(skill.getName(), skill);
		skill.setParent(this);
	}
	
	public void learnSkill(String skillName, int amount) {
		Skill skill = skills.get(skillName);
		knownSkills.put(skillName, skill);
		skill.increaseSkill(amount);
	}
	
	public void increaseSkill(String skillName, int amount) {
		skills.get(skillName).increaseSkill(amount);
	}
	
	public String getName() {
		return name;
	}
	
	public GameCharacter getParent() {
		return parent;
	}
	
	public HashMap<String, Skill> getSkills() {
		return skills;
	}
	
	public HashMap<String, Skill> getKnownSkills() {
		return knownSkills;
	}
	
	public int getRating() {
		return rating;
	}

	public Skill getSkill(String skill) {
		return skills.get(skill);
	}
}
